package cn.niit.pm.service.impl;

import cn.niit.pm.dao.RecruitMapper;
import cn.niit.pm.entity.Recruit;
import cn.niit.pm.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 招聘管理
 * @author xiaomi
 */

@Component
@Service
public class RecruitServiceImpl implements RecruitService {
    @Resource
    private RecruitMapper recruitMapper;



    @Override
    public List<Recruit> selectListByRecruit(Recruit recruit) {

        return recruitMapper.selectListByRecruit(recruit);
    }

    /**
     * 添加招聘信息
     * @param recruit
     * @return
     */

    @Override
    public int add(Recruit recruit) {
        recruit.setGmtCreate(new Date());
        int rows = recruitMapper.insertRecruit(recruit);
        return rows;
    }

    /**
     * 根据招聘ID查询招聘信息
     * @param recruitId
     * @return
     */

    @Override
    public Recruit selectByrecruitId(Integer recruitId) {
        return recruitMapper.selectByrecruitId(recruitId);
    }

    /**
     * 更新招聘信息
     * @param recruit
     * @return
     */

    @Override
    public int updateRecruit(Recruit recruit) {

        return recruitMapper.updateRecruit(recruit);
    }

    /**
     * 删除招聘计划
     * @param recruitId
     * @return
     */

    @Override
    public int deleteByRecruitId(Integer recruitId) {
        return recruitMapper.deleteByRecruitId(recruitId);
    }
}
